package com.example.demonstrate.wang.config;

import com.example.demonstrate.wang.entity.ProfileFace;
import com.example.demonstrate.wang.model.JianfengFace;
import com.example.demonstrate.wang.model.PanshiFace;
import com.example.demonstrate.wang.model.XuanyuanFace;
import com.example.demonstrate.wang.service.FaceTransformer;
import com.example.demonstrate.wang.service.ISystemSelectService;
import com.example.demonstrate.wang.service.impl.*;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author along
 * @Date 2024/6/21 16:11
 */

@Configuration
public class SystemConfig {

    @Bean
    @ConditionalOnProperty(name = "system.type", havingValue = "xuanyuan")
    public ISystemSelectService xuanyuanSelectService() {
        return new XuanyuanServiceImpl();
    }

    @Bean
    @ConditionalOnProperty(name = "system.type", havingValue = "panshi")
    public ISystemSelectService panshiSelectService() {
        return new PanshiServiceImpl();
    }

    @Bean
    @ConditionalOnProperty(name = "system.type", havingValue = "jianfeng")
    public ISystemSelectService jianfengSelectService() {
        return new JianfengServiceImpl();
    }

    @Bean
    @ConditionalOnProperty(name = "system.active", havingValue = "jianfeng")
    public FaceTransformer<JianfengFace, ProfileFace> jianfengTransformer() {
        return new JianfengTransformer();
    }

    @Bean
    @ConditionalOnProperty(name = "system.active", havingValue = "xuanyuan")
    public FaceTransformer<XuanyuanFace, ProfileFace> xuanyuanTransformer() {
        return new XuanyuanTransformer();
    }

    @Bean
    @ConditionalOnProperty(name = "system.active", havingValue = "panshi")
    public FaceTransformer<PanshiFace, ProfileFace> panshiTransformer() {
        return new PanshiTransformer();
    }
}
